# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=haskell-openafp-utils
pkgver=1.4.1.3
pkgrel=1
pkgdesc='Assorted utilities to work with AFP data streams.'
arch=('x86_64' 'aarch64')
url='http://hackage.haskell.org/package/OpenAFP-Utils'
license=('custom:PublicDomain')
depends=('haskell-openafp' 'haskell-iconv' 'haskell-line2pdf' 'haskell-xhtml')
makedepends=('ghc')
#install=haskell-openafp-utils.install
source=("http://hackage.haskell.org/packages/archive/OpenAFP-Utils/$pkgver/OpenAFP-Utils-$pkgver.tar.gz")
sha512sums=('cae1e8252a9548ad36a4be8672b737fea64d7259e3bfd060e47c73eb268adade2860d9c3fa53af036a2a1f85b1e68225282677277e6da22a4e96264d7b8b75ac')
options=('staticlibs')

build() {
  cd "OpenAFP-Utils-$pkgver"

  runhaskell Setup configure -O -p --enable-split-objs --enable-shared \
    --prefix=/usr --docdir="/usr/share/doc/haskell-openafp-utils" \
    --libsubdir=\$compiler/site-local/\$pkgid
  runhaskell Setup build
  runhaskell Setup haddock
  #runhaskell Setup register --gen-script
  #runhaskell Setup unregister --gen-script
  #sed -i -r -e "s|ghc-pkg.*unregister[^ ]* |&'--force' |" unregister.sh
}

package() {
  cd "OpenAFP-Utils-$pkgver"

  #install -Dm744 register.sh "$pkgdir/usr/share/haskell/haskell-openafp-utils/register.sh"
  #install -m744 unregister.sh "$pkgdir/usr/share/haskell/haskell-openafp-utils/unregister.sh"
  install -dm 755 "$pkgdir/usr/share/doc/ghc/html/libraries"
  ln -s "/usr/share/doc/$pkgname/html" \
    "$pkgdir/usr/share/doc/ghc/html/libraries/OpenAFP-Utils"
  runhaskell Setup copy --destdir="$pkgdir"
}

